<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    //输入一个年份,判断是否是闰年? isRun(2000) => true|false


    // var year = 2001;
    // if(year % 4 == 0 && year % 100 !=0 || year % 400==0){
    //     document.write(year+"是闰年");
    // }else{
    //     document.write(year+"是平年");
    // }


    // 此函数直接将结果输出到页面上 => 在页面直接看 
    /* function isRun(year) {
        // var year = 2001;
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            document.write(year + "是闰年");
        } else {
            document.write(year + "是平年");
        }
    }

    isRun(2300);*/
    


    function isRun(year) {
        // var year = 2001;
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            return true;
        } else {
            return false;
        }
    }

    var result = isRun(2400); // false
    console.log(result);


    var result = isRun(2023); // false
    console.log(result);

</script>

</html>